/**
 * @file bull_hal_sys_mutex.h
 * @brief 
 * @author yejing (yejh@gongniu.cn)
 * @version 1.0
 * @date 2024-05-08
 * 
 * Copyright 2021-2023 GongNiu Inc. All Rights Reserved.
 * 
 */

#ifndef __BULL_HAL_SYS_MUTEX_H__
#define __BULL_HAL_SYS_MUTEX_H__

#include <stdint.h>
#include "bull_hal_adapter.h"
#ifdef __cplusplus
extern "C" {
#endif



/**
 * @brief 用于创建并初始化tuya mutex
 * 
 * @param[out] pMutexHandle 返回mutex句柄
 * @return int 0=成功，非0=失败
 */
int bull_hal_sys_mutex_create(MUTEX_HANDLE *pMutexHandle);


/**
 * @brief  用于lock tuya mutex
 * 
 * @param[in] mutexHandle tuya mutex句柄
 * @return int 0=成功，非0=失败
 */
int bull_hal_sys_mutex_lock(const MUTEX_HANDLE mutexHandle);


/**
 * @brief   用于unlock tuya mutex
 * 
 * @param[in] mutexHandle tuya mutex句柄
 * @return int 0=成功，非0=失败
 */
int bull_hal_sys_mutex_unlock(const MUTEX_HANDLE mutexHandle);


/**
 * @brief  用于释放tuya mutex
 * 
 * @param[in] mutexHandle MUTEX_HANDLE tuya mutex句柄
 * @return int 0=成功，非0=失败
 */
int bull_hal_sys_mutex_delete(const MUTEX_HANDLE mutexHandle);



#ifdef __cplusplus
}
#endif

#endif